<template>
    <div id="storeMana">
        <div class="menu-left">
            <router-link v-if="isShowBack" class="index_nav_item" tag="div" active-class="active_class" to="/store" replace>
                <i class="iconfont">《</i><span>返回Sales</span>
            </router-link>
            <router-link class="index_nav_item" tag="div" active-class="active_class" to="/storeMana/goodsMana" replace>
                <i class="iconfont icon-ziliao"></i><span>原料管理</span>
            </router-link>
            <router-link class="index_nav_item" tag="div" active-class="active_class" to="/storeMana/typeMana" replace>
                <i class="iconfont icon-ziliao"></i><span>分类管理</span>
            </router-link>
            <router-link class="index_nav_item" tag="div" active-class="active_class" to="/storeMana/specMana" replace>
                <i class="iconfont icon-ziliao"></i><span>单位管理</span>
            </router-link>
            <router-link class="index_nav_item" tag="div" active-class="active_class" to="/storeMana/orderMana" replace>
                <i class="iconfont icon-ziliao"></i><span>订单管理</span>
            </router-link>
            <div v-if="!isShowBack" class="index_nav_item logout" @click="logout" tag="div" active-class="active_class"  replace>
                <i class="iconfont"></i><span>退出登录</span>
            </div>
        </div>
        <div class="view">
            <div class="view-wrap">
                <router-view></router-view>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data(){
        return{
            isShowBack:true,
            routerName:"原料管理"
        }
    },
    watch:{
        "$route.path":function(){
            let routePath = this.$route.fullPath;
            switch (routePath) {
                case "/storeMana/typeMana":
                    this.routerName = "分类管理";
                    break;
                case "/storeMana/goodsMana":
                    this.routerName = "原料管理";
                    break;
                case "/storeMana/specMana":
                    this.routerName = "单位管理";
                    break;
                default:
                    break;
            }
        }
    },
    methods:{
        logout(){
            localStorage.clear();
            sessionStorage.clear();
            this.$router.replace({path:'/login'});
        }
    },
    mounted(){
        let userData = JSON.parse(sessionStorage.getItem("userData"));
        if(userData){
            if(userData.mobile=="18482220260"){
                this.isShowBack = false;
            }
        }
    }
}
</script>

<style lang="scss">
@import "./storeMana.scss";
@import "./base.scss";
</style>
